package es.us.lsi.daw.modelmysql;

import java.util.Calendar;

import javax.persistence.Column;
import javax.persistence.Entity;
import javax.persistence.JoinColumn;
import javax.persistence.OneToOne;
import javax.persistence.Table;
import javax.persistence.Temporal;
import javax.persistence.TemporalType;

import es.us.lsi.daw.model.util.BaseEntity;

@Entity
@Table(name="lpcore_tweetentity")
public class TweetEntity extends BaseEntity{

	private static final long serialVersionUID = 1L;
	
	public static final String A_ID_TWITTER = "idTwitter";
	public static final String A_AUTHOR = "author";
//	public static final String A_FROM_USER = "fromUser";
//	public static final String A_FROM_USER_ID = "fromUserId";
	public static final String A_ISO_LANGUAGE_CODE = "isoLanguageCode";
	public static final String A_LOCATION = "location";
	public static final String A_PROFILE_IMAGE_URL = "profileImageUrl";
	public static final String A_SOURCE = "source";
	public static final String A_TO_USER = "toUser";
	public static final String A_TO_USER_ID = "toUserId";
	public static final String A_PUBLISH_DATE = "publishDate";		
	public static final String A_LATITUDE_GEOLOCATION = "latitudeGeoLocation";	
	public static final String A_LONGITUDE_GEOLOCATION = "longitudeGeoLocation";	
	public static final String A_TEXT = "text";	
	public static final String A_TWEET_REPLIED = "tweetReplied";
	public static final String A_TWEET_RETWEETED = "tweetRetweeted";
	
	private static final String ID_TWITTER = "id_twitter";
	private static final String AUTHOR = "author";
//	private static final String FROM_USER = "from_user";
//	private static final String FROM_USER_ID = "from_user_id";
	private static final String ISO_LANGUAGE_CODE = "iso_language_code";
	private static final String LOCATION = "location";
	private static final String PROFILE_IMAGE_URL = "profile_image_url";
	private static final String SOURCE = "source";
	private static final String TO_USER = "to_user";
	private static final String TO_USER_ID = "to_user_id";
	private static final String PUBLISH_DATE = "publish_date";		
	private static final String LATITUDE_GEOLOCATION = "latitude_geo_location";	
	private static final String LONGITUDE_GEOLOCATION = "longitude_geo_location";	
	private static final String TEXT = "text";	
	private static final String TWEET_REPLIED = "tweet_replied";
	private static final String TWEET_RETWEETED = "tweet_retweeted";
	
	
	
	@Column(name=ID_TWITTER,unique=true,nullable=false)
	private Long idTwitter;
	
	@OneToOne
	@JoinColumn(name = AUTHOR, referencedColumnName=TwitterUser.C_ID_TWITTER, nullable = false)
	private TwitterUser author;
	
	@Column(name=ISO_LANGUAGE_CODE)
	private String isoLanguageCode;
	
	@Column(name=LOCATION)
	private String location;
	
	@Column(name=PROFILE_IMAGE_URL,length=2000)
	private String profileImageUrl;
	
	@Column(name=SOURCE)
	private String source;

	@Column(name=TO_USER)
	private String toUser;
	
	@Column(name=TO_USER_ID)
	private Long toUserId;	
	
	@Column(name=PUBLISH_DATE,nullable=false)
	@Temporal(TemporalType.TIMESTAMP)
	private Calendar publishDate;
	
	@Column(name=LATITUDE_GEOLOCATION)
	private Double latitudeGeoLocation;
	
	@Column(name=LONGITUDE_GEOLOCATION)
	private Double longitudeGeoLocation;
	
	@Column(name=TEXT,nullable=false)
	private String text;
	
	@Column(name=TWEET_REPLIED)
	private Long tweetReplied;
	
	@Column(name=TWEET_RETWEETED)
	private Long tweetRetweeted;

	public TweetEntity() {
		super();
	}

	public Long getIdTwitter() {
		return idTwitter;
	}

	public String getIsoLanguageCode() {
		return isoLanguageCode;
	}

	public String getLocation() {
		return location;
	}

	public String getProfileImageUrl() {
		return profileImageUrl;
	}

	public String getSource() {
		return source;
	}

	public String getToUser() {
		return toUser;
	}

	public Long getToUserId() {
		return toUserId;
	}

	public Calendar getPublishDate() {
		return publishDate;
	}

	public Double getLatitudeGeoLocation() {
		return latitudeGeoLocation;
	}

	public Double getLongitudeGeoLocation() {
		return longitudeGeoLocation;
	}

	public String getText() {
		return text;
	}

	public void setIdTwitter(Long idTwitter) {
		this.idTwitter = idTwitter;
	}

	public void setIsoLanguageCode(String isoLanguageCode) {
		this.isoLanguageCode = isoLanguageCode;
	}

	public void setLocation(String location) {
		this.location = location;
	}

	public void setProfileImageUrl(String profileImageUrl) {
		this.profileImageUrl = profileImageUrl;
	}

	public void setSource(String source) {
		this.source = source;
	}

	public void setToUser(String toUser) {
		this.toUser = toUser;
	}

	public void setToUserId(Long toUserId) {
		this.toUserId = toUserId;
	}

	public void setPublishDate(Calendar publishDate) {
		this.publishDate = publishDate;
	}

	public void setLatitudeGeoLocation(Double latitudeGeoLocation) {
		this.latitudeGeoLocation = latitudeGeoLocation;
	}

	public void setLongitudeGeoLocation(Double longitudeGeoLocation) {
		this.longitudeGeoLocation = longitudeGeoLocation;
	}

	public void setText(String text) {
		this.text = text;
	}

	public Long getTweetReplied() {
		return tweetReplied;
	}

	public void setTweetReplied(Long tweetReplied) {
		this.tweetReplied = tweetReplied;
	}

	public Long getTweetRetweeted() {
		return tweetRetweeted;
	}

	public void setTweetRetweeted(Long tweetRetweeted) {
		this.tweetRetweeted = tweetRetweeted;
	}

	public TwitterUser getAuthor() {
		return author;
	}

	public void setAuthor(TwitterUser author) {
		this.author = author;
	}
	
}
